<!--
 * @Descripttion: 
 * @version: 1.0
 * @Author: Sam
 * @Date: 2022-04-07 20:18:30
 * @LastEditors: Sam
 * @LastEditTime: 2022-05-11 23:59:08
-->
<template>
    <div class="app-container">
        <div class="tech-border-out">
            <div class="tech-border">
                <el-card>
                    <div slot="header" class="clearfix">
                        <dv-decoration-7 style="width:200px;height:30px;;"> <p style="padding: 0 5px;">管理员操作记录</p>  </dv-decoration-7>
                    </div>
                    <div class="filter-container">
                        <el-input v-model="listQuery.searchword" :placeholder="'请输入关键字'" clearable style="width: 200px;margin-right: 10px;" class="filter-item" @keyup.enter.native="handleFilter" />
                        <el-button v-waves  class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">
                        {{ '搜索' }}
                        </el-button>
                    </div>
                    <el-table
                        :header-cell-style="{background:'#eef1f6',color:'#606266'}"
                        :data="list"
                        class="table-container"
                        fit
                        highlight-current-row
                        size="medium"
                        style="width: 100%"
                        >   
                        <el-table-column  :label="'操作'" prop="title" align="center">
                        </el-table-column>
                        <el-table-column  :label="'接口链接'" prop="url" align="center">
                        </el-table-column>
                        <el-table-column  :label="'操作人'" prop="admin_name" align="center">
                        </el-table-column>
                        <el-table-column  :label="'操作IP'" prop="admin_ip" align="center">
                        </el-table-column>
                        <el-table-column  :label="'请求方式'" prop="method" align="center">
                        </el-table-column>
                        <el-table-column  :label="'操作时间'" prop="add_time" align="center">
                        </el-table-column>
                    </el-table>
                    <dv-decoration-10 :dur="1" style="height:5px;" />
                    <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
                </el-card>
            </div>
        </div>
    </div>
</template>

<script>

    import waves from '@/directive/waves' // waves directive
    import permission from '@/directive/permission/index.js' // 权限判断指令
    import checkPermission from '@/utils/permission' // 权限判断函数
    import { list_log} from '@/api/admin'
    import { parseTime } from '@/utils'
    import { getToken } from '@/utils/auth'
    import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
    export default{
        name: 'admin_log',
        components: { Pagination},
        filters: {
            parseTime
        },
        directives: { waves, permission },
          data() {
            return {
            headerObj: {
                'Authorization': 'Bearer ' + getToken()
            },
            list: null,
            total: 0,
            select_ids : [],
            // listLoading: true,
            listQuery: {
                page: 1,
                limit: 10
            },
   
            create: {
                dialogVisible: false
            },
     
            detail: {
                dialogVisible: false,
                data: []
            },
             edit: { // 编辑
                dialogVisible: false,
                id: ''
            }
            }
        },
          created() {
            this.getList()
        },
        methods: {

            checkPermission,
            handleFilter() {
                this.listQuery.page = 1
                this.getList()
            },

            getList() {
                // this.listLoading = true
                list_log(this.listQuery).then(response => {
                        this.list = response.data.data
                        this.total = response.data.total
                        // this.listLoading = false
                    })
                },
            }
    }
</script>

